table.deepCopy = function(tb)
    local nt = {}
    local function ff(src, dst, depth)
        depth = depth + 1
        assert(depth <= 20)
        for k, v in pairs(src) do
            if type(v) == "table" then
                dst[k] = {}
                ff(v, dst[k], depth)
            else
                dst[k] = v
            end
        end
    end
    ff(tb, nt, 0)
    return nt
end
